Platform Explorer / Nuxeo Platform LTS 2017 9.10

Component org.nuxeo.ecm.platform.rendition.download.contrib

Contributions

XML Source

<?xml version="1.0"?>
<component name="org.nuxeo.ecm.platform.rendition.download.contrib">

  <extension target="org.nuxeo.ecm.platform.rendition.service.RenditionService"
    point="renditionDefinitions">

    <renditionDefinition name="mainBlob" visible="false">
      <operationChain>mainBlob</operationChain>
      <allowEmptyBlob>true</allowEmptyBlob>
      <contentType></contentType>
    </renditionDefinition>

    <renditionDefinition name="containerDefaultRendition" visible="false">
      <contentType>application/zip</contentType>
      <operationChain>containerContentBlob</operationChain>
      <allowEmptyBlob>true</allowEmptyBlob>
      <filters>
        <filter-id>container</filter-id>
      </filters>
    </renditionDefinition>

  </extension>

  <extension target="org.nuxeo.ecm.platform.rendition.service.RenditionService"
    point="defaultRendition">
    <defaultRendition>
      <script language="JavaScript">
        function run() {
          if (Reason == 'download') {
            if (Document.getType() == "File") {
              return 'mainBlob';
            } else if (Document.getType() == 'Picture') {
              return 'mainBlob';
            } else if (Document.getType() == 'Video') {
              return 'mainBlob';
            } else if (Document.getType() == 'Audio') {
              return 'mainBlob';
            } else if (Document.getType() == 'Note') {
              return 'pdf';
            } else if (Document.getType() == 'Collection') {
              return 'containerDefaultRendition';
            } else if (Document.getType() == 'Folder') {
              return 'containerDefaultRendition';
            } else {
              return 'xmlExport';
            }
          } else {
            return 'xmlExport';
          }
        }
      </script>
    </defaultRendition>
  </extension>

  <extension target="org.nuxeo.ecm.core.operation.OperationServiceComponent"
    point="chains">

    <chain id="mainBlob">
      <operation id="Context.PopDocument" />
      <operation id="Document.GetBlob" />
    </chain>

    <chain id="containerContentBlob">
      <operation id="Context.PopDocument" />
      <operation id="Document.GetContainerRendition">
        <param type="string" name="reason">download</param>
        <param type="int" name="limit">200</param>
        <param type="int" name="maxDepth">2</param>
      </operation>
    </chain>

  </extension>

</component>